#pragma once 
#include <map>
#include <point_cloud/PclCommon.h>

class SemanticCloud
{
public:
    // 存储不同类别的点云
    PointCloud::Ptr floor, wall, ceiling, valid_cloud;

    std::map<std::string, int> label_map = {
        {"ceiling", 0},
        {"floor", 1},
        {"wall", 2},
        {"clutter", 3}
    };

    SemanticCloud() : 
        floor(new PointCloud),
        wall(new PointCloud),
        ceiling(new PointCloud),
		valid_cloud(new PointCloud){}
    
    void fromPointCloud(PointCloud::Ptr &cloud)
    {
        floor->clear();
		wall->clear();
		ceiling->clear();
		valid_cloud->clear();

        // 根据标签分开点云
		for(auto p : cloud->points)
		{	
			int class_id = (int)p.curvature;
			switch (class_id)
			{
			case 0:
				ceiling->points.push_back(p);
				break;
			case 1:
				floor->points.push_back(p);
				break;
			case 2:
				wall->points.push_back(p);
				break;
			default:
				break;
			}
		}
		*valid_cloud += *floor;
		*valid_cloud += *ceiling;
		*valid_cloud += *wall;
    }
};
